import type { PageParam, PageResult } from '@vben/request';

import { requestClient } from '#/api/request';

export namespace TeamApplyApi {
  /** 团队申请信息 */
  export interface TeamApply {
    id?: number;
    // TODO: 添加字段
  }

  /** 团队申请分页查询参数 */
  export interface TeamApplyPageReqVO extends PageParam {
    createTime?: string[];
    // TODO: 添加查询条件字段
  }
}

/** 查询团队申请分页 */
export function getTeamApplyPage(params: TeamApplyApi.TeamApplyPageReqVO) {
  return requestClient.get<PageResult<TeamApplyApi.TeamApply>>(
    '/cmt/team-apply/page',
    { params },
  );
}

/** 查询团队申请详情 */
export function getTeamApply(id: number) {
  return requestClient.get<TeamApplyApi.TeamApply>(
    `/cmt/team-apply/get?id=${id}`,
  );
}

/** 新增团队申请 */
export function createTeamApply(data: TeamApplyApi.TeamApply) {
  return requestClient.post('/cmt/team-apply/create', data);
}

/** 修改团队申请 */
export function updateTeamApply(data: TeamApplyApi.TeamApply) {
  return requestClient.put('/cmt/team-apply/update', data);
}

/** 删除团队申请 */
export function deleteTeamApply(id: number) {
  return requestClient.delete(`/cmt/team-apply/delete?id=${id}`);
}

/** 批量删除团队申请 */
export function deleteTeamApplyList(ids: number[]) {
  return requestClient.delete(
    `/cmt/team-apply/delete-list?ids=${ids.join(',')}`,
  );
}

/** 导出团队申请 */
export function exportTeamApply(params: any) {
  return requestClient.download('/cmt/team-apply/export-excel', { params });
}
